import os
import unittest
from cases.Base_Case import BASECASE
from config.config import DATA_PATH
from page.index import IndexPage
from page.门诊医生站.门诊退方.menzhentuifang__page import Menzhentuifang
from tools.sjqd_way import read_data_from_excel
class Testtuifang(BASECASE):
    @classmethod
    def setUpClass(cls):
        ap = IndexPage()
        ap.jrym_no1('门诊退方')
    @classmethod
    def tearDownClass(cls):
        ap = IndexPage()
        ap.close_all_xxk()
        print("{}执行完毕-------------------------------------------------".format(cls))
    #门诊退方
    def test_1_menzhentuifang(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        bp = Menzhentuifang()
        bp.input_hzxm(name)#输入患者姓名
        bp.click_chaxun_btn()#点击查询按钮
        bp.click_chufang1()#点击第一条数据
        bp.click_tuifang_btn()#点击退方按钮
        bp.click_tishiqueding_btn()#点击确定按钮
        bp.click_chufang2()  # 点击第二条数据
        bp.click_tuifang_btn()  # 点击退方按钮
        bp.tishi.Refind()
        bp.tishiqueding.Refind()
        bp.click_tishiqueding_btn()  # 点击确定按钮
    #取消退方
    @unittest.skip
    def test_2_quxiaotuifang(self):
        bp = Menzhentuifang()
        bp.chufang1.Refind()
        bp.click_chufang1()#点击第一条数据
        bp.click_quxiaotuifang_btn()#点击取消退方按钮
        bp.chufang2.Refind()
        bp.click_chufang2()  # 点击第二条数据
        bp.click_quxiaotuifang_btn()#点击取消退方按钮

if __name__ == '__main__':
    unittest.main()

